<template>
    <div class="content-card">
      <el-image
        v-if="content.cover"
        :src="content.cover"
        class="card-cover"
        fit="cover"
      />
      
      <div class="card-body">
        <h3 class="card-title">{{ content.title }}</h3>
        <p class="card-summary">{{ content.summary }}</p>
        
        <div class="card-meta">
          <span>{{ content.author }}</span>
          <span>{{ content.publishTime }}</span>
        </div>
        
        <div class="card-actions">
          <el-button
            :type="content.isLiked ? 'primary' : 'text'"
            :icon="content.isLiked ? 'el-icon-thumb' : 'el-icon-thumb'"
            @click="$emit('like', content.id)"
          >
            {{ content.likeCount }}
          </el-button>
          
          <el-button type="text" icon="el-icon-chat-line-round">
            {{ content.commentCount }}
          </el-button>
          
          <el-button type="text" icon="el-icon-star-off">
            收藏
          </el-button>
        </div>
      </div>
    </div>
  </template>
  
  <script setup>
  defineProps({
    content: {
      type: Object,
      required: true
    }
  })
  </script>
  
  <style scoped>
  .content-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease;
  }
  
  .content-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  }
  
  .card-cover {
    width: 100%;
    height: 200px;
    display: block;
  }
  
  .card-body {
    padding: 15px;
  }
  
  .card-title {
    font-size: 18px;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  
  .card-summary {
    color: var(--el-text-color-secondary);
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  
  .card-meta {
    display: flex;
    justify-content: space-between;
    color: var(--el-text-color-placeholder);
    font-size: 14px;
    margin-bottom: 10px;
  }
  
  .card-actions {
    display: flex;
    gap: 10px;
  }
  </style>